package com.custom.lessonstudy.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.custom.lessonstudy.R;
import com.custom.lessonstudy.di.BaseMvpActivity;
import com.custom.lessonstudy.ui.presenter.MainPresenter;
import com.custom.lessonstudy.ui.view.MainView;

public class MainActivity extends BaseMvpActivity< MainView, MainPresenter> implements MainView {
    private TextView tvFirst;
    private  Button btn;
    private  Button btn2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
         btn = findViewById(R.id.btn);
        btn2 = findViewById(R.id.btn2);
        tvFirst = findViewById(R.id.tv_first);
        init();
    }



    @Override
    public MainView createView() {
        return this;
    }

    @Override
    public MainPresenter createPresenter() {
        return new MainPresenter();
    }

    private void init() {
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (presenter != null) {
                    presenter.getData("mainActivity");

                }
            }
        });

        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, TwoActivity.class));
            }
        });
    }

    @Override
    public void onError(String message) {
    }

    @Override
    public void onSmsSuccess(String type, String value) {
      //  ToastUtils.showLong("type==="+type+": value===="+value);
        Log.d("LUO","type==="+type+": value===="+value);
    }
}